package cn.taoticket.service;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.taoticket.mapper.TaoticketAreaMapper;
import cn.taoticket.pojo.TaoticketArea;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketAreaService {

    @Resource
     private TaoticketAreaMapper taoticketAreaMapper;

     @RequestMapping(value = "/getTaoticketAreaById",method = RequestMethod.POST)
     public TaoticketArea getTaoticketAreaById(@RequestParam("id") Long id)throws Exception{
        return taoticketAreaMapper.getTaoticketAreaById(id);
     }

     @RequestMapping(value = "/getTaoticketAreaListByMap",method = RequestMethod.POST)
     public List<TaoticketArea>	getTaoticketAreaListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketAreaMapper.getTaoticketAreaListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketAreaCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketAreaCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketAreaMapper.getTaoticketAreaCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketArea",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketArea(@RequestBody TaoticketArea taoticketArea)throws Exception{
        taoticketArea.setCreatedTime(new Date());
        return taoticketAreaMapper.insertTaoticketArea(taoticketArea);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketArea",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketArea(@RequestBody TaoticketArea taoticketArea)throws Exception{
        taoticketArea.setUpdatedTime(new Date());
        return taoticketAreaMapper.updateTaoticketArea(taoticketArea);
     }
}
